home *** CD-ROM | disk | FTP | other *** search
- Path: lasernet.com!jonathan_wooldridge
- Newsgroups: comp.lang.c++
- Message-ID: <60109230008$71C7@lasernet.com>
- X-Gateway: Act-Up 4.6 09 Jan 96 23:00:08 LaserNet, Serving Fido style systems
- Date: Tue, 9 Jan 96 21:08:45 LOC
- Organization: 1BBS ■ Imperial Beach CA ■ 619∙429∙6521/6123 ■ (52:1000/153)
- From: Jonathan Wooldridge <jonathan_wooldridge@lasernet.com>
- In-Reply-To: Eric Novinscak
- Subject: Randomizer
-
- -=> Quoting Eric Novinscak to All <=-
- EN> Fm IntrNet: kerning@nbnet.nb.ca [comp.lang.c++]
- EN> I got a little die rolling program and I'm trying to get it to roll a
- EN> different side each time you run the program but it always ends up on
- EN> the same side on the final roll. I'm using Borland C++ 4.5 with the
- EN> randomizer function and random. Can anyone help please!!!!
-
- Firstly, be sure to #include <time.h> as the random funcs depend on the clock.
- Secondly, be sure to
- randomize();
- before actually using the random functions. This way you will get a
- different series each time. However, I've tried this with Borland v3.1,
- and the results weren't very random. To be sure, the bell curve was ok,
- but it usually decayed into an obvious series relatively quickly.
-
- Snippits has source for an excellent algorithm for random number generation.
- if you would like, I'll send you several source files.
-
- -SpyroGyra
- ---
- ■ TLX v4.00 ■ Documentation - The worst part of programming.
-
- ---
-